<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>车辆价签</title>
    <meta http-equiv="X-UA-Compatible" content="ie=edge,ie=11,chrome=1" />
    <link rel="stylesheet" type="text/css" href="../css/price.css">
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/config.js"></script>
    <script type="text/javascript" src="../js/filter.js"></script>
    <script type="text/javascript" src="../js/qrcode.js"></script>
  </head>
<body >
<div id="pricePage" style="background-color:#ccc">
     <div id="appPrices" >
        <div class="price-logos">
          <img class="logo" src="../images/xa.png" v-if="res.marketId == 139">
          <img class="logo" src="../images/ss.png" v-else-if="res.marketId == 143">
          <img class="logo" src="../images/wf.png" v-else-if="res.marketId == 144">
          <img class="logo" src="../images/ts.png" v-else-if="res.marketId == 145">
          <img class="logo" src="../images/qy-logo.png" v-else>
          <dl>
              <dt class="put-logo" >
                  <img  alt="">
              </dt>
              <dd>{{res.shop.shopName  || ''}}</dd>
          </dl>
      </div>
        <div class="prices-titles"><span><span class="auth" v-if="res.carAuthState == 10"><img src="../images/auth.png" /></span>{{res.brand.brandName || ''}} {{res.model.modelName || ''}}</span></div>
        <div class="price-prices">
            <div class="price-mid">
                <!-- <span class="v-fonts">预售价</span> -->
                <span class="v-fonts2">售价：</span>
                <span class="new-price" v-if="res.carGuidePrice && res.carRetailPrice && res.carRetailPrice >= 0">新车含税价：{{newPrice}}万元&nbsp;&nbsp;&nbsp;&nbsp;省{{salePrice}}万元</span>
                <span class="price-nums change-price" style="height: 150px;padding-top: 50px;" v-if="res.carRetailPrice && res.carRetailPrice >= 0"><span style="font-size:100px;">￥</span>{{res.carRetailPrice}}<span>万元</span></span>
                <span class="price-nums face" style="font-size:150px;line-height:280px;" v-else="res.carRetailPrice && res.carRetailPrice >= 0">面议</span>
            </div>
        </div>
        <div class="car-qrcode">
            <div class="bom-code2">
                <dl class="car-num">
                    <dt id="right-code"> 
                        <div class="qylogo-two">
                            <img src="https://erp.anpxd.com/cars/images/logo.jpg">
                        </div>
                    </dt>
                    <dd>扫一扫，查看车辆详情</dd>
                </dl>
            </div>
            <div class="qr-tip-box">
                <div class="qr-tip" v-if="res.carFinanceService && res.carFinanceService == 1">首付最低20%</div>
                <div class="qr-tip" v-if="res.car4sUpkeepState && res.car4sUpkeepState == 1" >4S店定期保养</div>
            </div>
            
        </div>
        <div class="user-url2">
            <p class="user-mobiles2"><img src="../images/price-tel2.png" />{{res.user.userName}}：{{res.user.userMobile || "暂无"}}</p> 
        </div>

        <div class="price-table price2-table">
            <div class="price-detials price2-detials">
                <p>
                    <span class="b-left">上牌时间：<a v-if="res.carLicenceDate">{{res.carLicenceDate | filterGetDate}}</a><a v-else="res.carLicenceDate">暂无</a></span>
                    <span class="b-right">排量：<a v-if="res.carDisplacement">{{res.carDisplacement + res.carInletModel}}</a><a v-else="res.carDisplacement">暂无</a></span>
                </p>
                <p>
                    <span class="b-left">表显里程：<a v-if="res.carMileage">{{res.carMileage}}万公里</a><a v-else="res.carMileage">暂无</a></span>
                    <span class="b-right">变速箱：{{res.carGearbox || '-'}}</span>
                </p>
                <p>
                    <span class="b-left">排放标准：{{res.carEnviron || '-'}}</span>
                    <span class="b-right">车身颜色：{{res.carOutColor || '-'}}</span>
                </p>
                <p>
                    <span class="b-left">交强险到期日：<a v-if="res.carForceInsuranceDate">{{res.carForceInsuranceDate | filterGetDate}}</a><a v-else="res.carForceInsuranceDate">暂无</a></span>
                    <span class="b-right">年检到期日：{{res.carValidateDate | filterGetDate}}</span> 
                </p>
            </div>
        </div>
        <div class="cars-conf">
            <div class="cars-conf-one clearfix" v-if="confList.length > 0">
                <label>车辆配置：</label>
                <div class="conf-list" >
                    <span class="conf-item" v-for="item in confList" >{{item}}</span>
                </div>
            </div>
            <div class="cars-conf-two clearfix" v-if="res.carSellingPointDesc">
                <label style="height:50px">车辆描述：</label>
                <div class="car-infor">{{res.carSellingPointDesc}}</div>
            </div>
        </div>
        
        
        <div class="price-bottoms"><div class="bom-img"><img class="logos" src="../images/bom-logo.png" alt="" />
    <img class="long-img" src="../images/qwx.png" /></div></div>
    </div>
    <div id="printBtnGroup">
        <div class="item-btn" onclick="turnToPricetTag2()">价签样式一</div>
        <div class="item-btn" onclick="turnToPricetTag1()">价签样式二</div>
        <div class="item-btn" id="thisPrintBtn" onclick="printPriceTag()">打印价签</div>
    </div>
</div>
</body>
  <script type="text/javascript">
    if (GetQueryString('hideBtn')) {
      $('#thisPrintBtn').hide();
    }
    var pricetag = new Vue({
      el:'#appPrices',
      data: {
        res: {
            model:{},
            brand:{},
            series:{},
            shop:{},
            user:{},
        },
        confList:[],
        carConfs: '',
        carConf: ["氙气大灯", "GPS导航", "电动车窗", "真皮座椅", "定速巡航"],

        bright: ["全程4S店维修保养", "包过户", "旧车换新车", "以租代购", "延保服务(1年/2万公里)"],
        isAdd: false,
        chose: [],
        noChose: [],
        carConfList:[],
        ind: ''
      },
      computed:{
        newPrice(){
          return (this.res.carGuidePrice + (this.res.carGuidePrice/1.17 * 0.1)).toFixed(2)
        },
        salePrice(){
           return (this.newPrice - this.res.carRetailPrice).toFixed(2)
        }
      },
    });

    $.ajax({
      type: "get",      //data 传送数据类型。post 传递
      dataType: 'json',  // 返回数据的数据类型json
      url: defaultUrl+"/controller/getPrintCarInfo",  // yii 控制器/方法
      cache: false,
      data: {'carId': carId},  //传送的数据
      error:function(){
        alert("数据传输错误");
      },success: function (data) {
        if (data.code == 1) {
          pricetag.res = data.result.car;
          setQrCode(data.result.car);
          if (data.result.carConfInfoStr != '') {
              pricetag.confList = data.result.carConfInfoStr.split('，').slice(0,10);
          }
        }else if (data.code == 2) {
          if (data.result.code = 2) {
            pricetag.res = data.result.car;
            setQrCode(data.result.car);
            if (data.result.carConfInfoStr != '') {
                pricetag.confList = data.result.carConfInfoStr.split('，').slice(0,10);
            }
          }
        }else{
          return false;
        }
      }
    });

    $.ajax({
      type: "get",      //data 传送数据类型。post 传递
      dataType: 'json',  // 返回数据的数据类型json
      url: defaultUrl+"/controller/getCarConfById",  // yii 控制器/方法
      cache: false,
      data: {'carId': carId},  //传送的数据
      error:function(){
         alert("数据传输错误");
      },success: function (data) {
        console.log(data);
         if (data.code != 1) {
          return false
         }
         for (var i = 0; i < data.result.length; i++) {
            for (var j = 0; j < data.result[i].childCarConf.length; j++) {
              if (data.result[i].childCarConf[j].selectedState) {
                pricetag.carConfList.push(data.result[i].childCarConf[j].confName);
              }
            }
         }
      }
    });
    function setQrCode(res){
      var rightCode = new QRCode(document.getElementById("right-code"), {
        width : 220,//设置宽高
        height : 220
      });
      rightCode.makeCode(window.location.origin+'/wx-web/controller/wx/toWxOpenOauth2?action=carDetail&state='+res.carId+'&marketId='+res.marketId);
    }
    function printPriceTag(){
      document.getElementById('printBtnGroup').style.display = "none";
      window.print();
      document.getElementById('printBtnGroup').style.display = "block";
    }
    function turnToPricetTag1(){
      window.location.href = "pricetag2.html"+ window.location.search
    }
    function turnToPricetTag2(){
      window.location.href = "pricetag.html"+ window.location.search
    }


  </script>
</html>


































